package com.runchinaup.textapp.domain;

import android.text.format.Time;
import android.util.Log;

public class TextData {

    //同步时间
    private void synchronizationTime() {
        Time t = new Time();
        t.setToNow();
        int year = (t.year % 2000);
        int month = t.month + 1;
        int day = t.monthDay;
        int hour = t.hour;
        int minutes = t.minute;
        int second = t.second;

        byte[] timeValue = new byte[]{
                (byte) 0xa1,
                0x5a,
                0x0a,
                0x06,
                (byte) year,
                (byte) month,
                (byte) day,
                (byte) hour,
                (byte) minutes,
                (byte) second,
                0};

        StringBuffer sb = new StringBuffer();
        for (byte b : timeValue) {
            sb.append(String.format("%02d", (b & 0xff)));
        }
        Log.e("16jingzhi: ", sb.toString());
        Log.e("synchronizationTime: ", year + "年" + month + "月");
    }

    public void text() {
        synchronizationTime();
    }


}
